<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Artikel verwalten</title>
</head>
<body>

<h1><center>Artikel, die ich im Moment anbiete</center></h1>

<%@ page import="java.sql.*" isThreadSafe="false" %>
<%@page import="Datenbankhandler.DBConn"%>
<%

Connection conn=DBConn.getConnection();
	
	String sSql   = "Select ID,Bezeichnung,Kategorie,Bieterpreis,Sofortpreis, Enddauer FROM Artikel where Lebensdauer='1' and Anbieter='"
	+session.getAttribute("login") +"'";    

	
Statement  st = null;
ResultSet  rs = null;
try{
	st=conn.createStatement();
	rs=st.executeQuery(sSql);


ResultSetMetaData rsmd = rs.getMetaData();
int n = rsmd.getColumnCount();
out.println( "<table align='center' border=30 cellspacing=5><tr>" );
for( int i=1; i<=n; i++ )    
  out.println( "<th>" + rsmd.getColumnName( i ) + "</th>" );
while( rs.next() )
{
  out.println( "</tr><tr>" );
  for(int i=1;i<=1; i++){
  	
  	out.println("<td><a href='InformationServlet?id="+rs.getString(i)+ "&submit=aendern1'>" + rs.getString(i)+ "</a></td>");
  	System.out.println(request.getParameter("artikelid"));
  }
  for( int i=2; i<=n; i++ )  {
    out.println( "<td>" + rs.getString( i ) + "</td>" ); 
  }
  }
  out.println( "</tr></table>" );
  
}
finally{
	DBConn.closeConnection();
	

}
%>

</body>
</html>